package com.mygame;

import android.graphics.Color;
import android.graphics.Paint;

public class Straight {
	
	float x1; 
	float y1;
	float x2;
	float y2;
	float a;
	float b;
	float c;
	float k;
	float k2;
	
	public Straight() {
		x1=0;
		y1=0;
		x2=0;
		y2=0;
	}
	
	public void setPoint(float x, float y) {
		if (x1==0) {
			x1=x;
			y1=y;
		} 
		else
		{
			x2=x;
			y2=y;
			equation();
			//buildPerpendicular();
		}
	}
	
	public void equation() {
		a=y2-y1;
		b=-(x2-x1);
		c=(y2-y1)*(-x1)+(x2-x1)*y1;
		k=(-a/b);
		k2=(b/a);
	}
	
	
	public void buildPerpendicular(Blade b) {
		//Paint p=new Paint();
		//p.setColor(Color.RED);
		
		//b=new Blade(p);
		b.equap(x2, y2, k2);
		b.setP(x2, y2);
		
		
	}
	
}